package com.sky.web.app;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/user/category")
public class AppCategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 分类列表查询(小程序)
     * @param type
     * @return
     */
    @GetMapping("/list")
    public Result findList(Integer type) {
        //1 接收参数
        //2 调用service
        List<Category> categoryList = categoryService.findByStatusAndType(type);
        return Result.success(categoryList);

    }
}
